import delimited "$data/NLSY97/region/region.csv", varn(1) clear
ren *, upper
do "$data/NLSY97/region/region-value-labels"
ren *, lower
ren pubid uniqid
drop keyb*
ren *region* region
drop cv
ren keyr race
drop keys
save "$temp/nlsy_1997_regions", replace

//nlsy moment data
use "$temp/nlsy_moment_data", clear
merge 1:1 uniqid using "$temp/nlsy_1997_regions", keep(match) nogen


tab ability
tab ability if region==1
tab ability if region==2
tab ability if region==3
tab ability if region==4



//now by parent income quartile
tab parent_inc_quart ability, row
tab parent_inc_quart ability if region==1, row
tab parent_inc_quart ability if region==2, row
tab parent_inc_quart ability if region==3, row
tab parent_inc_quart ability if region==4, row



tab parent_inc_quart ability, row
tab parent_inc_quart ability if region==1 & race == 4, row
tab parent_inc_quart ability if region==2 & race == 4, row
tab parent_inc_quart ability if region==3 & race == 4, row
tab parent_inc_quart ability if region==4 & race == 4, row



reg ability_raw i.parent_inc_quart if race == 4
reg ability_raw i.parent_inc_quart if region == 1 & race == 4
reg ability_raw i.parent_inc_quart if region == 2 & race == 4
reg ability_raw i.parent_inc_quart if region == 3 & race == 4
reg ability_raw i.parent_inc_quart if region == 4 & race == 4